import type { PlusColumn } from 'plus-pro-components'

import { cloneDeep } from 'lodash-es'

export function useForm() {
    const initialState = {
        name: '',
        qu: '',
        sheng: '',
        shi: '',
    }
    const form = ref(cloneDeep(initialState))

    const schema: PlusColumn[] = [
        {
            colProps: {
                span: 6,
            },
            label: '订单编号',
            prop: 'orderNo',
            valueType: 'copy',
        },
        {
            colProps: {
                span: 6,
            },
            label: '订单名称',
            prop: 'orderName',
            valueType: 'copy',
        },
        {
            colProps: {
                span: 6,
            },
            label: '甲方',
            prop: 'partyA',
            valueType: 'copy',
        },
        {
            colProps: {
                span: 6,
            },
            fieldProps: {
                endPlaceholder: '结束日期',
                startPlaceholder: '开始日期',
                type: 'daterange',
                valueFormat: 'YYYY-MM-DD',
            },
            label: '下单时间',
            prop: 'orderTime',
            valueType: 'date-picker',
        },
        {
            colProps: {
                span: 6,
            },
            label: '合同名称',
            prop: 'agreementName',
            valueType: 'copy',
        },
    ]
    return { form, initialState, schema }
}
